﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using HumanWorkflow.TextualDslParser.IronyParser;
using HumanWorkflow.SemanticModel;

namespace HumanWorkflow.TextualDslParserTest
{
    [TestClass]
    public class HwExternalBuilderTest
    {
        [TestMethod]
        public void HumanWorkflowExternalBuilderTest()
        {
            HwdlIronyModelBuilder builder = new HwdlIronyModelBuilder();
            string orderWorkflowDef = @"
/*
	This workflow is an order workflow
*/
workflow OrderWorkflow
{
    roles
    {
		#Customer care role definition#
		CustomerCare, // Customer Care looks after customers
		Inventory
    }
	
	#Start state#
    initial Start
	{
		goesto ConcordeCustomerData when Start;
	}
	
	#Concorde Customer Data state#
	manual ConcordeCustomerData
	{
		#ConcordanceReady transition#
		goesto AreAllItemsOnStock when ConcordanceReady;
		doneby CustomerCare;
	}
	
	#Are All Items On Stock definiton#
	decision AreAllItemsOnStock
	{
		goesto ShipItems when AllItemsAreOnStock;
		goesto SendNotificationEmailToCustomer when ItemsAreMissing;	
	}

	automatic SendNotificationEmailToCustomer
	{
		goesto ShipItems when default;
	}

	manual ShipItems
	{
		goesto Finish when ItemsShipped;
		doneby Inventory;
	}

	#Final state#
    final Finish;	
}
";
            HumanWorkflowSemanticModel model = builder.ParseHumanWorkflow(orderWorkflowDef);

            Assert.IsNotNull(model);
            Assert.AreEqual("OrderWorkflow", model.Name);


        }
    }
}
